@{
    var mj = Netnr.Extend.ToJObject(System.IO.File.ReadAllText(GlobalTo.WebRootPath + "/js/data/favorite.json"));
    var isHtmlPath = Netnr.Core.CacheTo.Get("GlobalKey-HtmlPath") as string;
}
<div class="container my-4">
    <div class="row">
        <div class="col-md-12">
            <div class="input-group">
                <div class="input-group-prepend">
                    <select class="custom-select" style="width:150px;" id="seGroup">
                        <option value="">全部</option>
                        @foreach (var gi in mj["links"])
                        {
                            <option value="@gi["group"].ToString()">@gi["group"].ToString()</option>
                        }
                    </select>
                </div>
                <input type="text" class="form-control" placeholder="搜索" id="txtSearch">
                <div class="input-group-prepend">
                    <button class="btn btn-success" id="btnSearch" title="双击空白处 重置搜索条件">搜索</button>
                </div>
            </div>
        </div>
    </div>
    @if (string.IsNullOrWhiteSpace(isHtmlPath))
    {
        <div class="row">
            <div class="col-md-12 mt-3">
                <a href="/build" target="_blank">生成静态HTML</a>

                <a href="/index.html" class="mx-3" target="_blank">访问静态HTML</a>
            </div>
        </div>
    }
    <div class="menubox" id="favoritebox">
        @foreach (var gi in mj["links"])
        {
            <div class="row">
                <div class="col-md-12 h5 mt-3"><i class="fa fa-fw text-muted fa-reorder"></i>@gi["group"].ToString()</div>
                @foreach (var item in gi["items"])
                {
                    var href = item["url"].ToString();
                    if (string.IsNullOrWhiteSpace(isHtmlPath) && !href.Contains("//"))
                    {
                        href = "/home" + href;
                    }

                    <div class="col-xl-3 col-md-4 col-sm-6 mb-2">
                        <div class="card">
                            <div class="card-body">
                                <a href="@href" target="_blank">
                                    <img src="/favicon.svg" data-icon="@item["icon"]?.ToString()" />
                                    <h5>@item["title"]?.ToString()</h5>
                                    <small>@(item["remark"]?.ToString() ?? item["title"]?.ToString())</small>
                                </a>
                            </div>
                        </div>
                    </div>
                }
            </div>
        }
    </div>

    <div class="row">
        <div class="col-md-12 mt-3 small text-muted">
            Source：<a target="_blank" href="https://github.com/netnr/np">https://github.com/netnr/np</a>
        </div>
    </div>
</div>

<script src="/js/index.js" asp-append-version="true"></script>